# Copyright (C) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

include $(SDK_DIR)/cfg.mak

ifeq ($(CFG_PRODUCT_TYPE),linux)
HISI_LINUX_ENV := ok
ifneq ($(HISI_LINUX_ENV),ok)
$(error "Please run 'source ./env.sh' before building!")
endif
endif
#=============SDK_DIR======================================================================
CFGS_DIR=${SDK_DIR}/configs
PUB_DIR=${SDK_DIR}/pub
SAMPLE_DIR=${SDK_DIR}/sample
SCRIPTS_DIR=${SDK_DIR}/scripts
SOURCE_DIR=${SDK_DIR}/source
TOOLS_DIR=${SDK_DIR}/tools/linux
TOOLCHAINS_DIR=${TOOLS_DIR}/toolchains
CFG_HI_BASE_ENV=" SDK_DIR CFGS_DIR PUB_DIR SAMPLE_DIR SCRIPTS_DIR SOURCE_DIR TOOLS_DIR "
TESTCODE_DIR=${SDK_DIR}/../TestCode
PEACH_DIR=${SDK_DIR}/../Peach
#=============SRC_DIR======================================================================
MSP_DIR=${SOURCE_DIR}/msp
COMPONENT_DIR=${SOURCE_DIR}/component
PLUGIN_DIR=${SOURCE_DIR}/plugin
ROOTFS_SRC_DIR=${SOURCE_DIR}/rootfs
BOOT_DIR=${SOURCE_DIR}/boot
SLAVEBOOT_DIR=${SOURCE_DIR}/slaveboot
KERNEL_DIR=${SOURCE_DIR}/kernel
COMMON_DIR=${SOURCE_DIR}/common
ATF_DIR=${KERNEL_DIR}/atf-2.0
HHEE_DIR=${SOURCE_DIR}/hhee
CFG_HI_BASE_ENV+=" MSP_DIR COMPONET_DIR ROOTFS_SRC_DIR BOOT_DIR KERNEL_DIR COMMON_DIR PLUGIN_DIR "
#=============TEE_DIR==================================================================
TEE_DIR=${LINUX_DIR}/drivers/hisilicon/tee
TEE_INCLUDE=${TEE_DIR}/tee_hisi/tzdriver
TEE_DRV_INCLUDE := $(TEE_DIR)/tee_hisi/tzdriver
ifeq ($(strip $(CFG_HI_ITRUSTEE_SUPPORT)), y)
HI_TEE_OS_DIR   := $(SDK_DIR)/source/tee/core/itrustee5.0
else
HI_TEE_OS_DIR   := $(SDK_DIR)/source/tee/core/trustedcore
endif
HI_TEE_API_DIR  := $(SDK_DIR)/source/tee/api
HI_TEE_DRV_DIR  := $(SDK_DIR)/source/tee/drv
HI_TEE_TA_DIR   := $(SDK_DIR)/source/tee/ta
#=============INCLUDE_DIR==================================================================
MSP_UNF_INCLUDE=${MSP_DIR}/include
MSP_API_INCLUDE=${MSP_DIR}/api/include
MSP_DRV_INCLUDE=${MSP_DIR}/drv/include
MSP_DRV_REG_INCLUDE=${MSP_DIR}/drv/include/reg_inc
COMMON_UNF_INCLUDE=${COMMON_DIR}/include
COMMON_API_INCLUDE=${COMMON_DIR}/api/include
COMMON_DRV_INCLUDE=${COMMON_DIR}/drv/include
CFG_HI_BASE_ENV+=" MSP_UNF_INCLUDE MSP_API_INCLUDE MSP_DRV_INCLUDE "
CFG_HI_BASE_ENV+=" COMMON_UNF_INCLUDE COMMON_API_INCLUDE COMMON_DRV_INCLUDE "
HI_BOARD_HEAD_FILE_DIR=${SDK_DIR}/source/custom/${CFG_HI_BOARD_NAME}
#=============PUB_DIR======================================================================
ROOTBOX_DIR=${PUB_DIR}/rootbox
ROOTBOX_BIN_DIR=${ROOTBOX_DIR}/bin
PEACH_INSTALL_DIR=$(PUB_DIR)/autotest/peach
TESTCODE_INSTALL_DIR=$(PUB_DIR)/autotest/testcode
IMAGE_DIR=${PUB_DIR}/image
INCLUDE_DIR=${PUB_DIR}/include
LIB_DIR=${PUB_DIR}/lib
STATIC_LIB_DIR=${LIB_DIR}/static
SHARED_LIB_DIR=${LIB_DIR}/share
EXTERN_LIB_DIR=${LIB_DIR}/extern
MODULE_DIR=${PUB_DIR}/kmod
ROOTFS_DIR=${PUB_DIR}/rootfs
BIN_DIR=${PUB_DIR}/bin
APP_DIR=${PUB_DIR}/app
CFG_HI_BASE_ENV+=" IMAGE_DIR INCLUDE_DIR LIB_DIR STATIC_LIB_DIR SHARED_LIB_DIR EXTERN_LIB_DIR "
CFG_HI_BASE_ENV+=" MODULE_DIR ROOTFS_DIR ROOTBOX_DIR BIN_DIR APP_DIR ROOTBOX_DIR "
#=============LINUX_DIR====================================================================
LINUX_DIR=${KERNEL_DIR}/${CFG_HI_KERNEL_VERSION}
CFG_HI_BASE_ENV+=" LINUX_DIR "

#=============SERVER_UNTILS=================================================================
SERVER_UNTILS_DIR=${TOOLS_DIR}/utils
MKIMAGE=${SERVER_UNTILS_DIR}/mkimage
MKBOOTARGS=$(SERVER_UNTILS_DIR)/mkbootargs-tool/mkbootargs
MKCRAMFS=${SERVER_UNTILS_DIR}/mkfs.cramfs
MKEXT2FS=${SERVER_UNTILS_DIR}/genext2fs
MKEXT4FS=${SERVER_UNTILS_DIR}/make_ext4fs
TUNE2FS=${SERVER_UNTILS_DIR}/tune2fs
E2FSCK=${SERVER_UNTILS_DIR}/e2fsck
MKSQUASHFS=${SERVER_UNTILS_DIR}/mksquashfs
MKJFFS2=${SERVER_UNTILS_DIR}/mkfs.jffs2
MKYAFFS=${SERVER_UNTILS_DIR}/mkyaffs2image610
MKUBIIMG=${SERVER_UNTILS_DIR}/mkubiimg.sh
FILECAP=${SERVER_UNTILS_DIR}/filecap
SCP=${SERVER_UNTILS_DIR}/cp
SRM=${SERVER_UNTILS_DIR}/rm
CFG_HI_BASE_ENV+=" MKIMAGE MKCRAMFS MKEXT2FS TUNE2FS E2FSCK MKSQUASHFS MKJFFS2 FILECAP SCP SRM "
#==============COMPILE TOOLS=================================================================
CROSS_COMPILE=$(CFG_HI_TOOLCHAINS_NAME)-
CFG_HI_BASE_ENV+=" CROSS_COMPILE "

#==============LIB COMPILE OPTIONS================================================================
#3. export CFG_HI_CFLAGS
CFG_HI_CFLAGS :=
CFG_HI_KMOD_CFLAGS :=
CFG_HI_BOARD_CONFIGS :=
CFG_HI_SEC_COMPILE_CFLAGS :=
#include board config file:hi_board.h
CFG_HI_CFLAGS += -I${HI_BOARD_HEAD_FILE_DIR}

#201811280929 add -Werror to upgrade warning to error to implement 0 warning rule
#CFG_HI_CFLAGS += -Werror
CFG_HI_KMOD_CFLAGS += -Werror
CFG_HI_KMOD_CFLAGS += -I$(srctree)/bounds_checking_function/include

#==============SEC COMPILE OPTIONS================================================================
CFG_HI_SEC_COMPILE_CFLAGS += -fstack-protector-all
CFG_HI_SEC_COMPILE_CFLAGS += -fstack-protector-strong
CFG_HI_SEC_COMPILE_CFLAGS += -fPIC
CFG_HI_SEC_COMPILE_CFLAGS += --target=arm-linux-ohosmusl
CFG_HI_SEC_COMPILE_CFLAGS += --sysroot=$(SYSROOT_PATH)
CFG_HI_SEC_COMPILE_CFLAGS += -Wno-error=unused-command-line-argument
#CFG_HI_SEC_COMPILE_CFLAGS += -fPIE

#for Peach optimization
#CFG_HI_CFLAGS += -DHI_PEACH_SUPPORT
#CFG_HI_KMOD_CFLAGS += -DHI_PEACH_SUPPORT

ifeq ($(CFG_HI_USER_DRV),y)
CFG_HI_KMOD_CFLAGS += -DCFG_HI_USER_DRV
endif

ifeq ($(CFG_HI_ASAN_TEST_SUPPORT),y)
CFG_ASAN_CFLAGS := -Wall -g -fsanitize=address -fsanitize=leak -fsanitize=undefined -O0 -fno-omit-frame-pointer
CFG_HI_CFLAGS += $(CFG_ASAN_CFLAGS)
endif

#==============FPGA/ASIC VERSION CONTROL=====================================================
#CFG_HI_FPGA := y

ifeq (${CFG_CPU_ARCH_ARM64},y)
#CFG_HI_CFLAGS+=-Wlong-long -Wformat -Wpointer-arith
#CFG_HI_CFLAGS+=-Werror=pointer-to-int-cast
CFG_HI_CFLAGS+=-DCONFIG_ARCH_LP64_MODE
CFG_HI_KMOD_CFLAGS+=-DCONFIG_ARCH_LP64_MODE
CFG_HI_BOARD_CONFIGS+=-DCONFIG_ARCH_LP64_MODE
endif
ifeq ($(CFG_HI_FPGA),y)
CFG_HI_CFLAGS+=-march=armv7-a -mcpu=cortex-a9
else
CFG_HI_CFLAGS+=-march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3-d16
endif

CFG_HI_KMOD_CFLAGS +=-Wno-error=date-time
CFG_HI_KMOD_CFLAGS +=-Wno-date-time
ifeq ($(CFG_HI_OPTM_SIZE_SUPPORT),y)
ifneq ($(CFG_HI_ASAN_TEST_SUPPORT),y)
CFG_HI_CFLAGS += -Os
endif
CFG_HI_CFLAGS += -c -ffunction-sections -Wall -DUSE_AEC -D_GNU_SOURCE -D_XOPEN_SOURCE=600
else
ifneq ($(CFG_HI_ASAN_TEST_SUPPORT),y)
CFG_HI_CFLAGS += -O2
endif
CFG_HI_CFLAGS += -c -Wall -DUSE_AEC -D_GNU_SOURCE -D_XOPEN_SOURCE=600
endif

ifndef CFG_HI_STATIC_LIB_ONLY
CFG_HI_CFLAGS+= -fPIC
endif

#ifeq (${CFG_HI_MCE_SUPPORT},y)
#CFG_HI_CFLAGS+=-DMCE_SUPPORT
#endif

ifeq ($(CFG_HI_MSP_BUILDIN),y)
CFG_MSP_BUILDTYPE := y
else
CFG_MSP_BUILDTYPE := m
endif

## FPGA/ASIC VERSION CONTROL
ifeq ($(CFG_HI_FPGA),y)
CFG_HI_CFLAGS += -DHI_FPGA
endif

#CFG_HI_CFLAGS+= -I${MSP_UNF_INCLUDE} -I${MSP_API_INCLUDE} -I${MSP_DRV_INCLUDE} -I${COMMON_UNF_INCLUDE} -I${COMMON_API_INCLUDE} -I${COMMON_DRV_INCLUDE}
CFG_HI_CFLAGS+= -DCHIP_TYPE_${CFG_HI_CHIP_TYPE} -D${CFG_HI_DDRC_CHANNEL_TYPE}

## common and other modules will use hi_debug.h, which refers to the HI_LOG_LEVEL
ifeq (y,$(CFG_HI_LOG_SUPPORT))
CFG_HI_CFLAGS += -DHI_LOG_SUPPORT=1
ifdef CFG_HI_LOG_LEVEL
CFG_HI_CFLAGS += -DHI_LOG_LEVEL=$(CFG_HI_LOG_LEVEL)
else
CFG_HI_CFLAGS += -DHI_LOG_LEVEL=1
endif
ifeq (y,$(CFG_HI_LOG_NETWORK_SUPPORT))
CFG_HI_CFLAGS += -DLOG_NETWORK_SUPPORT
endif
ifeq (y,$(CFG_HI_LOG_UDISK_SUPPORT))
CFG_HI_CFLAGS += -DLOG_UDISK_SUPPORT
endif
else
CFG_HI_CFLAGS += -DHI_LOG_SUPPORT=0
endif
ifeq (y,$(CFG_HI_UNIFIED_IMAGE_SUPPORT))
CFG_HI_CFLAGS += -DHI_UNIFIED_IMAGE_SUPPORT
endif
ifeq (y,$(CFG_HI_PROC_SUPPORT))
CFG_HI_CFLAGS += -DHI_PROC_SUPPORT=1
else
CFG_HI_CFLAGS += -DHI_PROC_SUPPORT=0
endif
ifeq (y,$(CFG_HI_FUZZ_TEST_SUPPORT))
CFG_HI_CFLAGS += -DHI_FUZZ_TEST_SUPPORT
endif
ifeq (y,$(CFG_HI_SMMU_SUPPORT))
CFG_HI_CFLAGS += -DHI_SMMU_SUPPORT
endif
ifeq (y,$(CFG_HI_HDR_SUPPORT))
CFG_HI_CFLAGS += -DHI_HDR_SUPPORT
endif
## common api and msp_deubg will use these macro
ifeq (y,$(CFG_HI_MEMMGR_SUPPORT))
CFG_HI_CFLAGS += -DCMN_MMGR_SUPPORT
endif

ifeq (y,$(CFG_HI_VI_SUPPORT))
CFG_HI_CFLAGS += -DHI_VI_SUPPORT
endif

ifeq (y,$(CFG_HI_RM_SUPPORT))
CFG_HI_CFLAGS += -DHI_RM_SUPPORT
endif

ifeq (y,$(CFG_HI_VENC_SUPPORT))
CFG_HI_CFLAGS += -DHI_VENC_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_SRS_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_SRS_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_DBX_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_DBX_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_DBX2_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_DBX2_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_SWS3D_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_SWS3D_SUPPORT
endif
ifeq ($(CFG_HI_HAEFFECT_SPECTRUM_SUPPORT),y)
CFG_HI_CFLAGS += -DHI_HAEFFECT_SPECTRUM_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_BASE_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_BASE_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_CUSTOM1_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_CUSTOM1_SUPPORT
endif
ifeq (y,$(CFG_HI_HAEFFECT_KDE_SUPPORT))
CFG_HI_CFLAGS += -DHI_HAEFFECT_KDE_SUPPORT
endif
ifeq (y,$(CFG_HI_TTS_SUPPORT))
CFG_HI_CFLAGS += -DHI_TTS_SUPPORT
endif
ifeq (y,$(CFG_HI_SONIC_SUPPORT))
CFG_HI_CFLAGS += -DHI_SONIC_SUPPORT
endif
ifeq (y,$(CFG_CUSTOM_PANELINDEX_IN_EEPROM))
CFG_HI_CFLAGS += -DCUSTOM_PANELINDEX_IN_EEPROM
endif

ifeq ($(CFG_HI_ADVCA_SUPPORT),y)
    CFG_HI_CFLAGS += -DHI_ADVCA_SUPPORT
    CFG_HI_CFLAGS += -DHI_ADVCA_TYPE_$(CFG_HI_ADVCA_TYPE)

    ifdef CFG_HI_ADVCA_FUNCTION
        ifeq ($(CFG_HI_ADVCA_FUNCTION),FINAL)
            CFG_HI_CFLAGS += -DHI_ADVCA_FUNCTION_RELEASE
        else
            CFG_HI_CFLAGS += -DHI_ADVCA_FUNCTION_$(CFG_HI_ADVCA_FUNCTION)
        endif
    endif

    ifeq ($(CFG_HI_ADVCA_USE_EXT1_RSA_KEY),y)
        CFG_HI_CFLAGS += -DHI_ADVCA_USE_EXT1_RSA_KEY
    endif
    ifeq ($(CFG_HI_ANTI_ROLL_BACK_SUPPORT),y)
        CFG_HI_CFLAGS += -DHI_ANTI_ROLL_BACK_SUPPORT
    endif

endif

ifeq ($(CFG_HI_TVP_SUPPORT),y)
CFG_HI_CFLAGS += -DHI_TEE_SUPPORT
endif

#=============KERNEL MODULE COMPILE OPTIONS=====================================================

CFG_HI_KMOD_CFLAGS += -I${HI_BOARD_HEAD_FILE_DIR}

CFG_HI_KMOD_CFLAGS += -DCHIP_TYPE_${CFG_HI_CHIP_TYPE} -D${CFG_HI_DDRC_CHANNEL_TYPE}

## FPGA/ASIC VERSION CONTROL
ifeq ($(CFG_HI_FPGA),y)
CFG_HI_KMOD_CFLAGS += -DHI_FPGA
endif

AT := @

ifeq ($(CFG_HI_SMMU_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_SMMU_SUPPORT
endif

ifeq ($(CFG_HI_HDR_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_HDR_SUPPORT
endif

ifeq ($(CFG_HI_KEYLED_CT1642_KERNEL_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_KEYLED_CT1642_KERNEL_SUPPORT
endif

ifeq ($(CFG_HI_MCE_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_MCE_SUPPORT
endif

ifeq ($(CFG_HI_GPIOI2C_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_GPIOI2C_SUPPORT
endif

ifeq ($(CFG_HI_VPSS_4K_BYPASS),y)
CFG_HI_KMOD_CFLAGS += -DHI_VPSS_4K_BYPASS
endif
## common and other modules will use drv_mem_ext.h, which refer to the CMN_MMGR_SUPPORT
ifeq (y,$(CFG_HI_MEMMGR_SUPPORT))
CFG_HI_KMOD_CFLAGS += -DCMN_MMGR_SUPPORT
endif

## common and other modules will use hi_debug.h, which refers to the HI_LOG_LEVEL
ifeq (y,$(CFG_HI_LOG_SUPPORT))
CFG_HI_KMOD_CFLAGS += -DHI_LOG_SUPPORT=1
ifdef CFG_HI_LOG_LEVEL
CFG_HI_KMOD_CFLAGS += -DHI_LOG_LEVEL=$(CFG_HI_LOG_LEVEL)
else
CFG_HI_KMOD_CFLAGS += -DHI_LOG_LEVEL=1
endif
else
CFG_HI_KMOD_CFLAGS += -DHI_LOG_SUPPORT=0
endif
ifeq (y,$(CFG_HI_PROC_SUPPORT))
CFG_HI_KMOD_CFLAGS += -DHI_PROC_SUPPORT=1
else
CFG_HI_KMOD_CFLAGS += -DHI_PROC_SUPPORT=0
endif

ifeq ($(CFG_HI_LOADER_APPLOADER),y)
CFG_HI_KMOD_CFLAGS += -DHI_LOADER_APPLOADER
endif

ifeq ($(CFG_HI_LOADER_RECOVERY),y)
CFG_HI_KMOD_CFLAGS += -DHI_LOADER_RECOVERY
endif

ifeq ($(CFG_HI_KEYLED_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_KEYLED_SUPPORT
endif

ifeq ($(CFG_HI_HDMI_SUPPORT_HDCP),y)
CFG_HI_KMOD_CFLAGS += -DHI_HDCP_SUPPORT
endif

ifeq ($(CFG_HI_SCI_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_SCI_SUPPORT
endif

ifeq ($(CFG_HI_VI_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_VI_SUPPORT
endif

ifeq ($(CFG_HI_PVR_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_PVR_SUPPORT
endif

ifeq ($(CFG_HI_VENC_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_VENC_SUPPORT
endif

ifeq ($(CFG_HI_AENC_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_AENC_SUPPORT
endif

ifeq ($(CFG_HI_SND_AMP_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_SND_AMP_SUPPORT
endif

ifeq ($(CFG_HI_BOOT_MUSIC_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_BOOT_MUSIC_SUPPORT
CFG_HI_CFLAGS 	   += -DHI_BOOT_MUSIC_SUPPORT
endif

ifeq ($(CFG_V553_DTB_DIFF),y)
CFG_HI_KMOD_CFLAGS += -DHI3751V553_SUPPORT
CFG_HI_CFLAGS 	   += -DHI3751V553_SUPPORT
endif

ifeq ($(CFG_HI_ADVCA_SUPPORT),y)
    CFG_HI_KMOD_CFLAGS += -DHI_ADVCA_SUPPORT
    CFG_HI_KMOD_CFLAGS += -DHI_ADVCA_TYPE_$(CFG_HI_ADVCA_TYPE)

    ifdef CFG_HI_ADVCA_FUNCTION
        ifeq ($(CFG_HI_ADVCA_FUNCTION),FINAL)
            CFG_HI_KMOD_CFLAGS += -DHI_ADVCA_FUNCTION_RELEASE
        else
            CFG_HI_KMOD_CFLAGS += -DHI_ADVCA_FUNCTION_$(CFG_HI_ADVCA_FUNCTION)
        endif
    endif
endif

ifeq ($(CFG_HI_TVP_SUPPORT),y)
CFG_HI_KMOD_CFLAGS += -DHI_TEE_SUPPORT
CFG_HI_KMOD_CFLAGS += -DHI_TVP_SUPPORT
endif
#=============BOARD CONFIGURATION OPTIONS=====================================================

CFG_HI_BOARD_CONFIGS += -I${HI_BOARD_HEAD_FILE_DIR} -D${CFG_HI_DDRC_CHANNEL_TYPE}

## FPGA/ASIC VERSION CONTROL
ifeq ($(CFG_HI_FPGA),y)
CFG_HI_BOARD_CONFIGS += -DHI_FPGA
endif

#=============TUNER BASIC ATTRIBUTE OPTIONS===================
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_NUMBER=$(CFG_HI_TUNER_NUMBER)

CFG_HI_BOARD_CONFIGS += -DHI_TUNER0_ID=0

ifeq ($(CFG_HI_TUNER_SIGNAL_CAB),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=0
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_SAT),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=1
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_DVB_T),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=2
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_DVB_T2),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=3
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_ISDB_T),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=4
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_ATSC_T),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=5
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_DTMB),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=6
endif
ifeq ($(CFG_HI_TUNER_SIGNAL_J83B),y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_SIGNAL_TYPE=7
endif

ifeq (${CFG_HI_TUNER_DEV_TYPE_XG_3BL},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=0
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_CD1616},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=1
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_ALPS_TDAE},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=2
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDCC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=3
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDA18250},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=4
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_CD1616_DOUBLE},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=5
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MT2081},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=6
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TMX7070X},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=7
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_R820C},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=8
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MXL203},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=9
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_AV2011},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=10
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_SHARP7903},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=11
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MXL101},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=12
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MXL603},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=13
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_IT9170},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=14
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_IT9133},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=15
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDA6651},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=16
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDA18250B},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=17
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_M88TS2022},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=18
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_RDA5815},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=19
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MXL254},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=20
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_CXD2861},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=21
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDA18273},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=22
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDA18275},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=23
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_R840},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=24
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MXL661},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=25
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_MXL601},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=26
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_TDA18275A},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=27
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_SI2151},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=28
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_R842},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=29
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_AV2018},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=30
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_ATBM2040},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=31
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_ATBM253},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=32
endif
ifeq (${CFG_HI_TUNER_DEV_TYPE_RT710},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TYPE=33
endif

ifneq (${CFG_HI_TUNER_DEV_ADDR},)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_DEV_ADDR=${CFG_HI_TUNER_DEV_ADDR}
else
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_DEV_ADDR=0xc6
endif

ifeq (${CFG_HI_DEMOD_DEV_TYPE_NONE},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=0
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_3130I},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=256
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_3130E},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=257
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_J83B},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=258
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_AVL6211},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=259
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_MXL101},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=260
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_MN88472},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=261
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_IT9170},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=262
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_IT9133},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=263
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_3136},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=264
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_3136I},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=265
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_MXL254},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=266
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_CXD2837},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=267
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_TDA8296I},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=268
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_ATBM8878},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=269
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_HIDTV100},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=270
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_ATBM7823},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=272
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_HI3137},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=273
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_SI2180},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=274
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_HIDTV200},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=275
endif
ifeq (${HI_UNF_DEMOD_DEV_TYPE_HD2312A},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=276
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_ATBM783X},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=277
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_HI3138},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=278
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_HIDTV210},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=279
endif
ifeq (${CFG_HI_DEMOD_DEV_TYPE_ATBM888X},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TYPE=280
endif

ifneq (${CFG_HI_DEMOD_DEV_ADDR},)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_DEV_ADDR=${CFG_HI_DEMOD_DEV_ADDR}
else
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_DEV_ADDR=0xb6
endif

ifeq (${CFG_HI_DEMOD_TS_DEFAULT},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TS_MODE=0
endif
ifeq (${CFG_HI_DEMOD_TS_PARALLEL_MODE_A},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TS_MODE=1
endif
ifeq (${CFG_HI_DEMOD_TS_PARALLEL_MODE_B},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TS_MODE=2
endif
ifeq (${CFG_HI_DEMOD_TS_SERIAL},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TS_MODE=3
endif
ifeq (${CFG_HI_DEMOD_TS_SERIAL_50},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TS_MODE=4
endif
ifeq (${CFG_HI_DEMOD_TS_SERIAL_2BIT},y)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_TS_MODE=5
endif

ifneq (${CFG_HI_DEMOD_I2C_CHANNEL},)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_I2C_CHANNEL=${CFG_HI_DEMOD_I2C_CHANNEL}
else
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_I2C_CHANNEL=1
endif

ifneq (${CFG_HI_DEMOD_RESET_GPIO},)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_RESET_GPIO=${CFG_HI_DEMOD_RESET_GPIO}
else
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_RESET_GPIO=0
endif

ifneq (${CFG_HI_DEMUX_PORT},)
CFG_HI_BOARD_CONFIGS += -DHI_DEMUX_PORT=${CFG_HI_DEMUX_PORT}
else
CFG_HI_BOARD_CONFIGS += -DHI_DEMUX_PORT=0
endif

#=============TUNER SATELLITE ATTRIBUTE OPTIONS===================
ifneq (${CFG_HI_DEMOD_REF_CLOCK},)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_REF_CLOCK=${CFG_HI_DEMOD_REF_CLOCK}
else
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD_REF_CLOCK=24000
endif

ifneq (${CFG_HI_TUNER_MAX_LPF},)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_MAX_LPF=${CFG_HI_TUNER_MAX_LPF}
else
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_MAX_LPF=34
endif

ifneq (${CFG_HI_TUNER_I2C_CLOCK},)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_I2C_CLOCK=${CFG_HI_TUNER_I2C_CLOCK}
else
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_I2C_CLOCK=400
endif

ifeq (${CFG_HI_TUNER_RFAGC_INVERT},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_RFAGC=0
endif
ifeq (${CFG_HI_TUNER_RFAGC_NORMAL},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_RFAGC=1
endif

ifeq (${CFG_HI_TUNER_IQSPECTRUM_NORMAL},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_IQSPECTRUM=0
endif
ifeq (${CFG_HI_TUNER_IQSPECTRUM_INVERT},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_IQSPECTRUM=1
endif

ifeq (${CFG_HI_TUNER_TSCLK_POLAR_FALLING},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TSCLK_POLAR=0
endif
ifeq (${CFG_HI_TUNER_TSCLK_POLAR_RISING},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TSCLK_POLAR=1
endif

ifeq (${CFG_HI_TUNER_TS_FORMAT_TS},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TS_FORMAT=0
endif
ifeq (${CFG_HI_TUNER_TS_FORMAT_TSP},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TS_FORMAT=1
endif

ifeq (${CFG_HI_TUNER_TS_SERIAL_PIN_0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TS_SERIAL_PIN=0
endif
ifeq (${CFG_HI_TUNER_TS_SERIAL_PIN_7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_TS_SERIAL_PIN=1
endif

ifeq (${CFG_HI_TUNER_DISEQCWAVE_NORMAL},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_DISEQCWAVE=0
endif
ifeq (${CFG_HI_TUNER_DISEQCWAVE_ENVELOPE},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_DISEQCWAVE=1
endif

ifeq (${CFG_HI_LNBCTRL_DEV_TYPE_NONE},y)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_TYPE=0
endif
ifeq (${CFG_HI_LNBCTRL_DEV_TYPE_MPS8125},y)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_TYPE=1
endif
ifeq (${CFG_HI_LNBCTRL_DEV_TYPE_ISL9492},y)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_TYPE=2
endif
ifeq (${CFG_HI_LNBCTRL_DEV_TYPE_TPS65233},y)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_TYPE=3
endif
ifeq (${CFG_HI_LNBCTRL_DEV_TYPE_LNBH25},y)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_TYPE=4
endif
ifeq (${CFG_HI_LNBCTRL_DEV_TYPE_STI8036},y)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_TYPE=5
endif

ifneq (${CFG_HI_LNBCTRL_DEV_ADDR},)
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_ADDR=${CFG_HI_LNBCTRL_DEV_ADDR}
else
CFG_HI_BOARD_CONFIGS += -DHI_LNBCTRL_DEV_ADDR=0x0
endif

#=============TUNER TSOUT OPTIONS===================
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN0_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN0=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN1_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN1=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN2_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN2=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN3_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN3=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN4_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN4=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN5_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN5=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN6_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN6=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN7_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN7=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN8_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN8=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN9_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN9=10
endif

ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=0
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=1
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=2
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=3
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=4
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=5
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=6
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=7
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=8
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=9
endif
ifeq (${CFG_HI_TUNER_OUTPUT_PIN10_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER_OUTPUT_PIN10=10
endif

ifeq ($(CFG_HI_TUNER1_SIGNAL_TYPE), cable)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_SIGNAL_TYPE=0
endif
ifeq ($(CFG_HI_TUNER1_SIGNAL_TYPE), dvbt)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_SIGNAL_TYPE=2
endif
ifeq ($(CFG_HI_TUNER1_SIGNAL_TYPE), dvbt2)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_SIGNAL_TYPE=3
endif

ifeq ($(CFG_HI_TUNER1_DEV_TYPE), xg_3bl)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=0
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), cd1616)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=1
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), alps_tdae)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=2
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), tdcc)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=3
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), tda18250)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=4
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), cd1616_double)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=5
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), mt2081)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=6
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), tmx7070x)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=7
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), r820c)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=8
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), mxl203)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=9
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), av2011)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=10
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), sharp7903)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=11
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), mxl101)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=12
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), mxl603)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=13
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), it9170)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=14
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), it9133)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=15
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), tda6651)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=16
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), tda18250b)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=17
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), m88ts2022)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=18
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), rda5815)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=19
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), mxl661)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=25
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), si2151)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=28
endif
ifeq ($(CFG_HI_TUNER1_DEV_TYPE), r842)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_TYPE=29
endif

CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_DEV_ADDR=${CFG_HI_TUNER1_DEV_ADDR}

ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, none)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=0
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, 3130i)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=256
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, 3130e)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=257
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, j83b)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=258
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, avl6211)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=259
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, mxl101)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=260
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, mn88472)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=261
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, it9170)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=262
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, it9133)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=263
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, 3136)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=264
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, 3136i)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=265
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, 3137)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=273
endif
ifeq (${CFG_HI_DEMOD1_DEV_TYPE}, 3138)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TYPE=274
endif

CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_DEV_ADDR=${CFG_HI_DEMOD1_DEV_ADDR}

ifeq (${CFG_HI_DEMOD1_TS_MODE}, parallel_a)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TS_MODE=1
endif
ifeq (${CFG_HI_DEMOD1_TS_MODE}, parallel_b)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TS_MODE=2
endif
ifeq (${CFG_HI_DEMOD1_TS_MODE}, serial)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TS_MODE=3
endif
ifeq (${CFG_HI_DEMOD1_TS_MODE}, serial_50)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TS_MODE=4
endif
ifeq (${CFG_HI_DEMOD1_TS_MODE}, serial_2bit)
CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_TS_MODE=5
endif

CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_I2C_CHANNEL=${CFG_HI_DEMOD1_I2C_CHANNEL}

CFG_HI_BOARD_CONFIGS += -DHI_DEMOD1_RESET_GPIO=${CFG_HI_DEMOD1_RESET_GPIO}

CFG_HI_BOARD_CONFIGS += -DHI_DEMUX1_PORT=${CFG_HI_DEMUX1_PORT}

#=============TUNER1 TSOUT OPTIONS===================
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN0_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN0=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN1_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN1=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN2_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN2=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN3_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN3=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN4_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN4=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN5_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN5=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN6_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN6=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN7_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN7=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN8_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN8=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN9_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN9=10
endif

ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT0},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=0
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT1},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=1
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT2},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=2
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT3},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=3
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT4},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=4
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT5},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=5
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT6},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=6
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSDAT7},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=7
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSVLD},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=8
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSSYNC},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=9
endif
ifeq (${CFG_HI_TUNER1_OUTPUT_PIN10_TSERR},y)
CFG_HI_BOARD_CONFIGS += -DHI_TUNER1_OUTPUT_PIN10=10
endif

#=============DISEQC DEVICE OPTIONS===================
ifeq (${CFG_HI_DISEQC_SUPPORT},y)
CFG_HI_BOARD_CONFIGS += -DDISEQC_SUPPORT
endif

ifeq (${CFG_HI_UNICABLE_SUPPORT},y)
CFG_HI_BOARD_CONFIGS += -DUNICABLE_SUPPORT
endif

ifeq (${CFG_HI_UNICABLE2_SUPPORT},y)
CFG_HI_BOARD_CONFIGS += -DUNICABLE2_SUPPORT
endif

#=============DAC CONFIGURATION OPTIONS===================
ifneq (${CFG_HI_DAC_CVBS},)
CFG_HI_BOARD_CONFIGS += -DHI_DAC_CVBS=${CFG_HI_DAC_CVBS}
else
CFG_HI_BOARD_CONFIGS += -DHI_DAC_CVBS=3
endif
ifneq (${CFG_HI_DAC_YPBPR_Y},)
CFG_HI_BOARD_CONFIGS += -DHI_DAC_YPBPR_Y=${CFG_HI_DAC_YPBPR_Y}
else
CFG_HI_BOARD_CONFIGS += -DHI_DAC_YPBPR_Y=1
endif
ifneq (${CFG_HI_DAC_YPBPR_PB},)
CFG_HI_BOARD_CONFIGS += -DHI_DAC_YPBPR_PB=${CFG_HI_DAC_YPBPR_PB}
else
CFG_HI_BOARD_CONFIGS += -DHI_DAC_YPBPR_PB=0
endif
ifneq (${CFG_HI_DAC_YPBPR_PR},)
CFG_HI_BOARD_CONFIGS += -DHI_DAC_YPBPR_PR=${CFG_HI_DAC_YPBPR_PR}
else
CFG_HI_BOARD_CONFIGS += -DHI_DAC_YPBPR_PR=2
endif

ifneq (${CFG_HI_SND_MUTECTL_GPIO},)
CFG_HI_BOARD_CONFIGS += -DHI_SND_MUTECTL_GPIO=${CFG_HI_DAC_SVIDEO_C}
else
CFG_HI_BOARD_CONFIGS += -DHI_SND_MUTECTL_GPIO=0x39
endif

#=============SCI CONFIGURATION OPTIONS===================
ifeq (${CFG_HI_SCI_CLK_MODE_CMOS},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_CLK_MODE=0
endif
ifeq (${CFG_HI_SCI_CLK_MODE_OD},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_CLK_MODE=1
endif

ifeq (${CFG_HI_SCI_VCCEN_MODE_CMOS},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_VCCEN_MODE=0
endif
ifeq (${CFG_HI_SCI_VCCEN_MODE_OD},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_VCCEN_MODE=1
endif

ifeq (${CFG_HI_SCI_RESET_MODE_CMOS},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_RESET_MODE=0
endif
ifeq (${CFG_HI_SCI_RESET_MODE_OD},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_RESET_MODE=1
endif

ifeq (${CFG_HI_SCI_VCCEN_LOW},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_VCCEN_LEVEL=0
endif
ifeq (${CFG_HI_SCI_VCCEN_HIGH},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_VCCEN_LEVEL=1
endif

ifeq (${CFG_HI_SCI_DETECT_LOW},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_DETECT_LEVEL=0
endif
ifeq (${CFG_HI_SCI_DETECT_HIGH},y)
CFG_HI_BOARD_CONFIGS += -DHI_SCI_DETECT_LEVEL=1
endif

#=============MEMC CONFIGURATION OPTIONS===================
ifeq (y,$(CFG_HI_MEMC_SUPPORT))
CFG_HI_CFLAGS += -DHI_MEMC_SUPPORT
CFG_HI_KMOD_CFLAGS += -DHI_MEMC_SUPPORT
endif
ifeq (y,$(CFG_HI_MEMC_ME_SUPPORT))
CFG_HI_CFLAGS += -DHI_MEMC_ME_SUPPORT
CFG_HI_KMOD_CFLAGS += -DHI_MEMC_ME_SUPPORT
endif
ifeq (y,$(CFG_HI_MEMC_FI_SUPPORT))
CFG_HI_CFLAGS += -DHI_MEMC_FI_SUPPORT
CFG_HI_KMOD_CFLAGS += -DHI_MEMC_FI_SUPPORT
endif


